package org.idea.spring.aop.demo;

/**
 * @Author linhao
 * @Date created in 10:46 上午 2021/5/4
 */
public class MyCalculate implements Calculate {

    @Override
    public int add(int numA, int numB) {
        System.out.println("[add]");
        return numA + numB;
    }

    @Override
    public int reduce(int numA, int numB) {
        System.out.println("[reduce]");
        return numA - numB;
    }

    @Override
    public int div(int numA, int numB) {
        System.out.println("[div]");
        return numA / numB;
    }

    @Override
    public int multi(int numA, int numB) {
        System.out.println("[multi]");
        return numA * numB;
    }

    /**
     * 方法内部再去调用其他方法，发现并没有打印日志信息
     *
     * @param numA
     * @param numB
     * @return
     */
    @Override
    public int mod(int numA, int numB) {
        System.out.println("[mod]");
        int result = this.add(numA,numB);
        int t = this.reduce(result,numA);
        int b = this.multi(t,result);
        int f = this.div(t,b);
        return f;
    }

    public static void main(String[] args) {
        MyCalculate myCalculate = new MyCalculate();
        System.out.println(myCalculate.add(100,90));
    }
}
